package com.hlkj.baojin.utils.hik;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 获取本地Ip
 * @author limingyi
 *
 */
public class GetIp {
  public static InetAddress getInetAddress(){

      try{
          return InetAddress.getLocalHost();
      }catch(UnknownHostException e){
          System.out.println("unknown host!");
      }
      return null;

  }

  public static String getHostIp(InetAddress netAddress){
      if(null == netAddress){
          return null;
      }
      String ip = netAddress.getHostAddress(); //get the ip address
      return ip;
  }



}